﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dhtl.Service.IService;
using DataBase.Daihoctuonglai;
using Dhtl_Repositry.Repository;

namespace Dhtl.Service.Service
{
    public class Service_CateAlbum : ICateAlbum
    {
        public List<Cate_Album> List()
        {
            using (CateAlbumRepository sv = new CateAlbumRepository())
            {
                return sv.List();
            }
        }

        public Cate_Album GetById(int id)
        {
            using (CateAlbumRepository sv = new CateAlbumRepository())
            {
                return sv.GetById(id);
            }
        }

        public List<Cate_Album> ListByParentId(int id)
        {
            using (CateAlbumRepository sv = new CateAlbumRepository())
            {
                return sv.GetTableListById(id);
            }
        }

        public int AddOrUpdate(Cate_Album entity)
        {
            using (CateAlbumRepository sv = new CateAlbumRepository())
            {
                return sv.CreateOrUpdate(entity);
            }
        }

        public void delete(int id)
        {
            using (CateAlbumRepository sv = new CateAlbumRepository())
            {
                sv.Delete(id);
            }
        }
    }
}
